// $ANTLR 3.3 Nov 30, 2010 12:45:30 /home/bartushk/Desktop/antlr/LogoTurtle.g 2011-03-24 18:07:13

import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;


import org.antlr.runtime.tree.*;

public class LogoTurtleParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "BLOCK", "COMMENT", "NEWLINE", "WS", "PENUP", "PENDOWN", "BFILL", "EFILL", "SETPOS", "CIRCLE", "SETPEN", "FORWARD", "BACKWARD", "LEFT", "RIGHT", "SETH", "IFSTAT", "WHILESTAT", "IFELSE", "PRINT", "TO", "END", "ID", "FLOAT", "INT", "MAKE", "OUTPUT", "REFOP", "COMPOP", "NOT", "ADD", "SUB", "DIV", "MUL", "MOD", "LETTER", "DIGIT", "'['", "']'", "'('", "')'"
    };
    public static final int EOF=-1;
    public static final int T__41=41;
    public static final int T__42=42;
    public static final int T__43=43;
    public static final int T__44=44;
    public static final int BLOCK=4;
    public static final int COMMENT=5;
    public static final int NEWLINE=6;
    public static final int WS=7;
    public static final int PENUP=8;
    public static final int PENDOWN=9;
    public static final int BFILL=10;
    public static final int EFILL=11;
    public static final int SETPOS=12;
    public static final int CIRCLE=13;
    public static final int SETPEN=14;
    public static final int FORWARD=15;
    public static final int BACKWARD=16;
    public static final int LEFT=17;
    public static final int RIGHT=18;
    public static final int SETH=19;
    public static final int IFSTAT=20;
    public static final int WHILESTAT=21;
    public static final int IFELSE=22;
    public static final int PRINT=23;
    public static final int TO=24;
    public static final int END=25;
    public static final int ID=26;
    public static final int FLOAT=27;
    public static final int INT=28;
    public static final int MAKE=29;
    public static final int OUTPUT=30;
    public static final int REFOP=31;
    public static final int COMPOP=32;
    public static final int NOT=33;
    public static final int ADD=34;
    public static final int SUB=35;
    public static final int DIV=36;
    public static final int MUL=37;
    public static final int MOD=38;
    public static final int LETTER=39;
    public static final int DIGIT=40;

    // delegates
    // delegators


        public LogoTurtleParser(TokenStream input) {
            this(input, new RecognizerSharedState());
        }
        public LogoTurtleParser(TokenStream input, RecognizerSharedState state) {
            super(input, state);
             
        }
        
    protected TreeAdaptor adaptor = new CommonTreeAdaptor();

    public void setTreeAdaptor(TreeAdaptor adaptor) {
        this.adaptor = adaptor;
    }
    public TreeAdaptor getTreeAdaptor() {
        return adaptor;
    }

    public String[] getTokenNames() { return LogoTurtleParser.tokenNames; }
    public String getGrammarFileName() { return "/home/bartushk/Desktop/antlr/LogoTurtle.g"; }


    public static class prog_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "prog"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:12:1: prog : ( stat )+ -> ^( BLOCK ( stat )+ ) ;
    public final LogoTurtleParser.prog_return prog() throws RecognitionException {
        LogoTurtleParser.prog_return retval = new LogoTurtleParser.prog_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        LogoTurtleParser.stat_return stat1 = null;


        RewriteRuleSubtreeStream stream_stat=new RewriteRuleSubtreeStream(adaptor,"rule stat");
        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:12:6: ( ( stat )+ -> ^( BLOCK ( stat )+ ) )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:12:8: ( stat )+
            {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:12:8: ( stat )+
            int cnt1=0;
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( ((LA1_0>=COMMENT && LA1_0<=TO)||(LA1_0>=MAKE && LA1_0<=OUTPUT)||LA1_0==43) ) {
                    alt1=1;
                }


                switch (alt1) {
            	case 1 :
            	    // /home/bartushk/Desktop/antlr/LogoTurtle.g:12:8: stat
            	    {
            	    pushFollow(FOLLOW_stat_in_prog43);
            	    stat1=stat();

            	    state._fsp--;

            	    stream_stat.add(stat1.getTree());

            	    }
            	    break;

            	default :
            	    if ( cnt1 >= 1 ) break loop1;
                        EarlyExitException eee =
                            new EarlyExitException(1, input);
                        throw eee;
                }
                cnt1++;
            } while (true);



            // AST REWRITE
            // elements: stat
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 12:14: -> ^( BLOCK ( stat )+ )
            {
                // /home/bartushk/Desktop/antlr/LogoTurtle.g:12:17: ^( BLOCK ( stat )+ )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(BLOCK, "BLOCK"), root_1);

                if ( !(stream_stat.hasNext()) ) {
                    throw new RewriteEarlyExitException();
                }
                while ( stream_stat.hasNext() ) {
                    adaptor.addChild(root_1, stream_stat.nextTree());

                }
                stream_stat.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "prog"

    public static class stat_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "stat"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:1: stat : ( ( print | make | ifstat | whilestat | ifelse | funcmake | funcreturn | COMMENT | NEWLINE | WS ) endstat | ( PENUP | PENDOWN | turtone | turtpos | turtcirc | turtpenc | BFILL | EFILL ) endstat );
    public final LogoTurtleParser.stat_return stat() throws RecognitionException {
        LogoTurtleParser.stat_return retval = new LogoTurtleParser.stat_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token COMMENT9=null;
        Token NEWLINE10=null;
        Token WS11=null;
        Token PENUP13=null;
        Token PENDOWN14=null;
        Token BFILL19=null;
        Token EFILL20=null;
        LogoTurtleParser.print_return print2 = null;

        LogoTurtleParser.make_return make3 = null;

        LogoTurtleParser.ifstat_return ifstat4 = null;

        LogoTurtleParser.whilestat_return whilestat5 = null;

        LogoTurtleParser.ifelse_return ifelse6 = null;

        LogoTurtleParser.funcmake_return funcmake7 = null;

        LogoTurtleParser.funcreturn_return funcreturn8 = null;

        LogoTurtleParser.endstat_return endstat12 = null;

        LogoTurtleParser.turtone_return turtone15 = null;

        LogoTurtleParser.turtpos_return turtpos16 = null;

        LogoTurtleParser.turtcirc_return turtcirc17 = null;

        LogoTurtleParser.turtpenc_return turtpenc18 = null;

        LogoTurtleParser.endstat_return endstat21 = null;


        CommonTree COMMENT9_tree=null;
        CommonTree NEWLINE10_tree=null;
        CommonTree WS11_tree=null;
        CommonTree PENUP13_tree=null;
        CommonTree PENDOWN14_tree=null;
        CommonTree BFILL19_tree=null;
        CommonTree EFILL20_tree=null;

        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:6: ( ( print | make | ifstat | whilestat | ifelse | funcmake | funcreturn | COMMENT | NEWLINE | WS ) endstat | ( PENUP | PENDOWN | turtone | turtpos | turtcirc | turtpenc | BFILL | EFILL ) endstat )
            int alt4=2;
            int LA4_0 = input.LA(1);

            if ( ((LA4_0>=COMMENT && LA4_0<=WS)||(LA4_0>=IFSTAT && LA4_0<=TO)||(LA4_0>=MAKE && LA4_0<=OUTPUT)||LA4_0==43) ) {
                alt4=1;
            }
            else if ( ((LA4_0>=PENUP && LA4_0<=SETH)) ) {
                alt4=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 4, 0, input);

                throw nvae;
            }
            switch (alt4) {
                case 1 :
                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:8: ( print | make | ifstat | whilestat | ifelse | funcmake | funcreturn | COMMENT | NEWLINE | WS ) endstat
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:8: ( print | make | ifstat | whilestat | ifelse | funcmake | funcreturn | COMMENT | NEWLINE | WS )
                    int alt2=10;
                    switch ( input.LA(1) ) {
                    case PRINT:
                    case 43:
                        {
                        alt2=1;
                        }
                        break;
                    case MAKE:
                        {
                        alt2=2;
                        }
                        break;
                    case IFSTAT:
                        {
                        alt2=3;
                        }
                        break;
                    case WHILESTAT:
                        {
                        alt2=4;
                        }
                        break;
                    case IFELSE:
                        {
                        alt2=5;
                        }
                        break;
                    case TO:
                        {
                        alt2=6;
                        }
                        break;
                    case OUTPUT:
                        {
                        alt2=7;
                        }
                        break;
                    case COMMENT:
                        {
                        alt2=8;
                        }
                        break;
                    case NEWLINE:
                        {
                        alt2=9;
                        }
                        break;
                    case WS:
                        {
                        alt2=10;
                        }
                        break;
                    default:
                        NoViableAltException nvae =
                            new NoViableAltException("", 2, 0, input);

                        throw nvae;
                    }

                    switch (alt2) {
                        case 1 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:9: print
                            {
                            pushFollow(FOLLOW_print_in_stat63);
                            print2=print();

                            state._fsp--;

                            adaptor.addChild(root_0, print2.getTree());

                            }
                            break;
                        case 2 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:17: make
                            {
                            pushFollow(FOLLOW_make_in_stat67);
                            make3=make();

                            state._fsp--;

                            adaptor.addChild(root_0, make3.getTree());

                            }
                            break;
                        case 3 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:24: ifstat
                            {
                            pushFollow(FOLLOW_ifstat_in_stat71);
                            ifstat4=ifstat();

                            state._fsp--;

                            adaptor.addChild(root_0, ifstat4.getTree());

                            }
                            break;
                        case 4 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:33: whilestat
                            {
                            pushFollow(FOLLOW_whilestat_in_stat75);
                            whilestat5=whilestat();

                            state._fsp--;

                            adaptor.addChild(root_0, whilestat5.getTree());

                            }
                            break;
                        case 5 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:45: ifelse
                            {
                            pushFollow(FOLLOW_ifelse_in_stat79);
                            ifelse6=ifelse();

                            state._fsp--;

                            adaptor.addChild(root_0, ifelse6.getTree());

                            }
                            break;
                        case 6 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:54: funcmake
                            {
                            pushFollow(FOLLOW_funcmake_in_stat83);
                            funcmake7=funcmake();

                            state._fsp--;

                            adaptor.addChild(root_0, funcmake7.getTree());

                            }
                            break;
                        case 7 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:64: funcreturn
                            {
                            pushFollow(FOLLOW_funcreturn_in_stat86);
                            funcreturn8=funcreturn();

                            state._fsp--;

                            adaptor.addChild(root_0, funcreturn8.getTree());

                            }
                            break;
                        case 8 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:77: COMMENT
                            {
                            COMMENT9=(Token)match(input,COMMENT,FOLLOW_COMMENT_in_stat90); 

                            }
                            break;
                        case 9 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:88: NEWLINE
                            {
                            NEWLINE10=(Token)match(input,NEWLINE,FOLLOW_NEWLINE_in_stat95); 

                            }
                            break;
                        case 10 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:14:99: WS
                            {
                            WS11=(Token)match(input,WS,FOLLOW_WS_in_stat100); 

                            }
                            break;

                    }

                    pushFollow(FOLLOW_endstat_in_stat105);
                    endstat12=endstat();

                    state._fsp--;


                    }
                    break;
                case 2 :
                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:15:4: ( PENUP | PENDOWN | turtone | turtpos | turtcirc | turtpenc | BFILL | EFILL ) endstat
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:15:4: ( PENUP | PENDOWN | turtone | turtpos | turtcirc | turtpenc | BFILL | EFILL )
                    int alt3=8;
                    switch ( input.LA(1) ) {
                    case PENUP:
                        {
                        alt3=1;
                        }
                        break;
                    case PENDOWN:
                        {
                        alt3=2;
                        }
                        break;
                    case FORWARD:
                    case BACKWARD:
                    case LEFT:
                    case RIGHT:
                    case SETH:
                        {
                        alt3=3;
                        }
                        break;
                    case SETPOS:
                        {
                        alt3=4;
                        }
                        break;
                    case CIRCLE:
                        {
                        alt3=5;
                        }
                        break;
                    case SETPEN:
                        {
                        alt3=6;
                        }
                        break;
                    case BFILL:
                        {
                        alt3=7;
                        }
                        break;
                    case EFILL:
                        {
                        alt3=8;
                        }
                        break;
                    default:
                        NoViableAltException nvae =
                            new NoViableAltException("", 3, 0, input);

                        throw nvae;
                    }

                    switch (alt3) {
                        case 1 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:15:5: PENUP
                            {
                            PENUP13=(Token)match(input,PENUP,FOLLOW_PENUP_in_stat112); 
                            PENUP13_tree = (CommonTree)adaptor.create(PENUP13);
                            adaptor.addChild(root_0, PENUP13_tree);


                            }
                            break;
                        case 2 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:15:13: PENDOWN
                            {
                            PENDOWN14=(Token)match(input,PENDOWN,FOLLOW_PENDOWN_in_stat116); 
                            PENDOWN14_tree = (CommonTree)adaptor.create(PENDOWN14);
                            adaptor.addChild(root_0, PENDOWN14_tree);


                            }
                            break;
                        case 3 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:15:23: turtone
                            {
                            pushFollow(FOLLOW_turtone_in_stat120);
                            turtone15=turtone();

                            state._fsp--;

                            adaptor.addChild(root_0, turtone15.getTree());

                            }
                            break;
                        case 4 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:15:33: turtpos
                            {
                            pushFollow(FOLLOW_turtpos_in_stat124);
                            turtpos16=turtpos();

                            state._fsp--;

                            adaptor.addChild(root_0, turtpos16.getTree());

                            }
                            break;
                        case 5 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:15:43: turtcirc
                            {
                            pushFollow(FOLLOW_turtcirc_in_stat128);
                            turtcirc17=turtcirc();

                            state._fsp--;

                            adaptor.addChild(root_0, turtcirc17.getTree());

                            }
                            break;
                        case 6 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:15:54: turtpenc
                            {
                            pushFollow(FOLLOW_turtpenc_in_stat132);
                            turtpenc18=turtpenc();

                            state._fsp--;

                            adaptor.addChild(root_0, turtpenc18.getTree());

                            }
                            break;
                        case 7 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:15:65: BFILL
                            {
                            BFILL19=(Token)match(input,BFILL,FOLLOW_BFILL_in_stat136); 
                            BFILL19_tree = (CommonTree)adaptor.create(BFILL19);
                            adaptor.addChild(root_0, BFILL19_tree);


                            }
                            break;
                        case 8 :
                            // /home/bartushk/Desktop/antlr/LogoTurtle.g:15:73: EFILL
                            {
                            EFILL20=(Token)match(input,EFILL,FOLLOW_EFILL_in_stat140); 
                            EFILL20_tree = (CommonTree)adaptor.create(EFILL20);
                            adaptor.addChild(root_0, EFILL20_tree);


                            }
                            break;

                    }

                    pushFollow(FOLLOW_endstat_in_stat144);
                    endstat21=endstat();

                    state._fsp--;


                    }
                    break;

            }
            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "stat"

    public static class turtpos_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "turtpos"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:18:1: turtpos : SETPOS '[' expr expr ']' ;
    public final LogoTurtleParser.turtpos_return turtpos() throws RecognitionException {
        LogoTurtleParser.turtpos_return retval = new LogoTurtleParser.turtpos_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token SETPOS22=null;
        Token char_literal23=null;
        Token char_literal26=null;
        LogoTurtleParser.expr_return expr24 = null;

        LogoTurtleParser.expr_return expr25 = null;


        CommonTree SETPOS22_tree=null;
        CommonTree char_literal23_tree=null;
        CommonTree char_literal26_tree=null;

        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:18:9: ( SETPOS '[' expr expr ']' )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:18:11: SETPOS '[' expr expr ']'
            {
            root_0 = (CommonTree)adaptor.nil();

            SETPOS22=(Token)match(input,SETPOS,FOLLOW_SETPOS_in_turtpos156); 
            SETPOS22_tree = (CommonTree)adaptor.create(SETPOS22);
            root_0 = (CommonTree)adaptor.becomeRoot(SETPOS22_tree, root_0);

            char_literal23=(Token)match(input,41,FOLLOW_41_in_turtpos159); 
            pushFollow(FOLLOW_expr_in_turtpos162);
            expr24=expr();

            state._fsp--;

            adaptor.addChild(root_0, expr24.getTree());
            pushFollow(FOLLOW_expr_in_turtpos164);
            expr25=expr();

            state._fsp--;

            adaptor.addChild(root_0, expr25.getTree());
            char_literal26=(Token)match(input,42,FOLLOW_42_in_turtpos166); 

            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "turtpos"

    public static class turtcirc_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "turtcirc"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:21:1: turtcirc : CIRCLE expr expr ;
    public final LogoTurtleParser.turtcirc_return turtcirc() throws RecognitionException {
        LogoTurtleParser.turtcirc_return retval = new LogoTurtleParser.turtcirc_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token CIRCLE27=null;
        LogoTurtleParser.expr_return expr28 = null;

        LogoTurtleParser.expr_return expr29 = null;


        CommonTree CIRCLE27_tree=null;

        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:21:10: ( CIRCLE expr expr )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:21:12: CIRCLE expr expr
            {
            root_0 = (CommonTree)adaptor.nil();

            CIRCLE27=(Token)match(input,CIRCLE,FOLLOW_CIRCLE_in_turtcirc178); 
            CIRCLE27_tree = (CommonTree)adaptor.create(CIRCLE27);
            root_0 = (CommonTree)adaptor.becomeRoot(CIRCLE27_tree, root_0);

            pushFollow(FOLLOW_expr_in_turtcirc181);
            expr28=expr();

            state._fsp--;

            adaptor.addChild(root_0, expr28.getTree());
            pushFollow(FOLLOW_expr_in_turtcirc183);
            expr29=expr();

            state._fsp--;

            adaptor.addChild(root_0, expr29.getTree());

            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "turtcirc"

    public static class turtpenc_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "turtpenc"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:24:1: turtpenc : SETPEN '[' expr expr expr ']' ;
    public final LogoTurtleParser.turtpenc_return turtpenc() throws RecognitionException {
        LogoTurtleParser.turtpenc_return retval = new LogoTurtleParser.turtpenc_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token SETPEN30=null;
        Token char_literal31=null;
        Token char_literal35=null;
        LogoTurtleParser.expr_return expr32 = null;

        LogoTurtleParser.expr_return expr33 = null;

        LogoTurtleParser.expr_return expr34 = null;


        CommonTree SETPEN30_tree=null;
        CommonTree char_literal31_tree=null;
        CommonTree char_literal35_tree=null;

        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:24:10: ( SETPEN '[' expr expr expr ']' )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:24:12: SETPEN '[' expr expr expr ']'
            {
            root_0 = (CommonTree)adaptor.nil();

            SETPEN30=(Token)match(input,SETPEN,FOLLOW_SETPEN_in_turtpenc194); 
            SETPEN30_tree = (CommonTree)adaptor.create(SETPEN30);
            root_0 = (CommonTree)adaptor.becomeRoot(SETPEN30_tree, root_0);

            char_literal31=(Token)match(input,41,FOLLOW_41_in_turtpenc197); 
            pushFollow(FOLLOW_expr_in_turtpenc200);
            expr32=expr();

            state._fsp--;

            adaptor.addChild(root_0, expr32.getTree());
            pushFollow(FOLLOW_expr_in_turtpenc202);
            expr33=expr();

            state._fsp--;

            adaptor.addChild(root_0, expr33.getTree());
            pushFollow(FOLLOW_expr_in_turtpenc204);
            expr34=expr();

            state._fsp--;

            adaptor.addChild(root_0, expr34.getTree());
            char_literal35=(Token)match(input,42,FOLLOW_42_in_turtpenc206); 

            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "turtpenc"

    public static class turtone_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "turtone"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:27:1: turtone : ( FORWARD | BACKWARD | LEFT | RIGHT | SETH ) expr ;
    public final LogoTurtleParser.turtone_return turtone() throws RecognitionException {
        LogoTurtleParser.turtone_return retval = new LogoTurtleParser.turtone_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token set36=null;
        LogoTurtleParser.expr_return expr37 = null;


        CommonTree set36_tree=null;

        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:27:9: ( ( FORWARD | BACKWARD | LEFT | RIGHT | SETH ) expr )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:27:11: ( FORWARD | BACKWARD | LEFT | RIGHT | SETH ) expr
            {
            root_0 = (CommonTree)adaptor.nil();

            set36=(Token)input.LT(1);
            set36=(Token)input.LT(1);
            if ( (input.LA(1)>=FORWARD && input.LA(1)<=SETH) ) {
                input.consume();
                root_0 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(set36), root_0);
                state.errorRecovery=false;
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                throw mse;
            }

            pushFollow(FOLLOW_expr_in_turtone240);
            expr37=expr();

            state._fsp--;

            adaptor.addChild(root_0, expr37.getTree());

            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "turtone"

    public static class ifstat_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "ifstat"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:30:1: ifstat : IFSTAT compare block -> ^( IFSTAT compare block ) ;
    public final LogoTurtleParser.ifstat_return ifstat() throws RecognitionException {
        LogoTurtleParser.ifstat_return retval = new LogoTurtleParser.ifstat_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token IFSTAT38=null;
        LogoTurtleParser.compare_return compare39 = null;

        LogoTurtleParser.block_return block40 = null;


        CommonTree IFSTAT38_tree=null;
        RewriteRuleTokenStream stream_IFSTAT=new RewriteRuleTokenStream(adaptor,"token IFSTAT");
        RewriteRuleSubtreeStream stream_compare=new RewriteRuleSubtreeStream(adaptor,"rule compare");
        RewriteRuleSubtreeStream stream_block=new RewriteRuleSubtreeStream(adaptor,"rule block");
        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:30:8: ( IFSTAT compare block -> ^( IFSTAT compare block ) )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:30:10: IFSTAT compare block
            {
            IFSTAT38=(Token)match(input,IFSTAT,FOLLOW_IFSTAT_in_ifstat251);  
            stream_IFSTAT.add(IFSTAT38);

            pushFollow(FOLLOW_compare_in_ifstat253);
            compare39=compare();

            state._fsp--;

            stream_compare.add(compare39.getTree());
            pushFollow(FOLLOW_block_in_ifstat255);
            block40=block();

            state._fsp--;

            stream_block.add(block40.getTree());


            // AST REWRITE
            // elements: compare, IFSTAT, block
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 30:31: -> ^( IFSTAT compare block )
            {
                // /home/bartushk/Desktop/antlr/LogoTurtle.g:30:34: ^( IFSTAT compare block )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_IFSTAT.nextNode(), root_1);

                adaptor.addChild(root_1, stream_compare.nextTree());
                adaptor.addChild(root_1, stream_block.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "ifstat"

    public static class whilestat_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "whilestat"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:33:1: whilestat : WHILESTAT '[' compare ']' block -> ^( WHILESTAT compare block ) ;
    public final LogoTurtleParser.whilestat_return whilestat() throws RecognitionException {
        LogoTurtleParser.whilestat_return retval = new LogoTurtleParser.whilestat_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token WHILESTAT41=null;
        Token char_literal42=null;
        Token char_literal44=null;
        LogoTurtleParser.compare_return compare43 = null;

        LogoTurtleParser.block_return block45 = null;


        CommonTree WHILESTAT41_tree=null;
        CommonTree char_literal42_tree=null;
        CommonTree char_literal44_tree=null;
        RewriteRuleTokenStream stream_42=new RewriteRuleTokenStream(adaptor,"token 42");
        RewriteRuleTokenStream stream_WHILESTAT=new RewriteRuleTokenStream(adaptor,"token WHILESTAT");
        RewriteRuleTokenStream stream_41=new RewriteRuleTokenStream(adaptor,"token 41");
        RewriteRuleSubtreeStream stream_compare=new RewriteRuleSubtreeStream(adaptor,"rule compare");
        RewriteRuleSubtreeStream stream_block=new RewriteRuleSubtreeStream(adaptor,"rule block");
        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:33:11: ( WHILESTAT '[' compare ']' block -> ^( WHILESTAT compare block ) )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:33:13: WHILESTAT '[' compare ']' block
            {
            WHILESTAT41=(Token)match(input,WHILESTAT,FOLLOW_WHILESTAT_in_whilestat276);  
            stream_WHILESTAT.add(WHILESTAT41);

            char_literal42=(Token)match(input,41,FOLLOW_41_in_whilestat278);  
            stream_41.add(char_literal42);

            pushFollow(FOLLOW_compare_in_whilestat280);
            compare43=compare();

            state._fsp--;

            stream_compare.add(compare43.getTree());
            char_literal44=(Token)match(input,42,FOLLOW_42_in_whilestat282);  
            stream_42.add(char_literal44);

            pushFollow(FOLLOW_block_in_whilestat284);
            block45=block();

            state._fsp--;

            stream_block.add(block45.getTree());


            // AST REWRITE
            // elements: block, compare, WHILESTAT
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 33:46: -> ^( WHILESTAT compare block )
            {
                // /home/bartushk/Desktop/antlr/LogoTurtle.g:33:49: ^( WHILESTAT compare block )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_WHILESTAT.nextNode(), root_1);

                adaptor.addChild(root_1, stream_compare.nextTree());
                adaptor.addChild(root_1, stream_block.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "whilestat"

    public static class ifelse_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "ifelse"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:36:1: ifelse : IFELSE compare block block -> ^( IFELSE compare block block ) ;
    public final LogoTurtleParser.ifelse_return ifelse() throws RecognitionException {
        LogoTurtleParser.ifelse_return retval = new LogoTurtleParser.ifelse_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token IFELSE46=null;
        LogoTurtleParser.compare_return compare47 = null;

        LogoTurtleParser.block_return block48 = null;

        LogoTurtleParser.block_return block49 = null;


        CommonTree IFELSE46_tree=null;
        RewriteRuleTokenStream stream_IFELSE=new RewriteRuleTokenStream(adaptor,"token IFELSE");
        RewriteRuleSubtreeStream stream_compare=new RewriteRuleSubtreeStream(adaptor,"rule compare");
        RewriteRuleSubtreeStream stream_block=new RewriteRuleSubtreeStream(adaptor,"rule block");
        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:36:8: ( IFELSE compare block block -> ^( IFELSE compare block block ) )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:36:10: IFELSE compare block block
            {
            IFELSE46=(Token)match(input,IFELSE,FOLLOW_IFELSE_in_ifelse305);  
            stream_IFELSE.add(IFELSE46);

            pushFollow(FOLLOW_compare_in_ifelse307);
            compare47=compare();

            state._fsp--;

            stream_compare.add(compare47.getTree());
            pushFollow(FOLLOW_block_in_ifelse309);
            block48=block();

            state._fsp--;

            stream_block.add(block48.getTree());
            pushFollow(FOLLOW_block_in_ifelse311);
            block49=block();

            state._fsp--;

            stream_block.add(block49.getTree());


            // AST REWRITE
            // elements: block, compare, IFELSE, block
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 36:37: -> ^( IFELSE compare block block )
            {
                // /home/bartushk/Desktop/antlr/LogoTurtle.g:36:40: ^( IFELSE compare block block )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_IFELSE.nextNode(), root_1);

                adaptor.addChild(root_1, stream_compare.nextTree());
                adaptor.addChild(root_1, stream_block.nextTree());
                adaptor.addChild(root_1, stream_block.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "ifelse"

    public static class block_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "block"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:40:1: block : '[' ( stat )+ ']' ;
    public final LogoTurtleParser.block_return block() throws RecognitionException {
        LogoTurtleParser.block_return retval = new LogoTurtleParser.block_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal50=null;
        Token char_literal52=null;
        LogoTurtleParser.stat_return stat51 = null;


        CommonTree char_literal50_tree=null;
        CommonTree char_literal52_tree=null;

        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:40:7: ( '[' ( stat )+ ']' )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:40:9: '[' ( stat )+ ']'
            {
            root_0 = (CommonTree)adaptor.nil();

            char_literal50=(Token)match(input,41,FOLLOW_41_in_block336); 
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:40:14: ( stat )+
            int cnt5=0;
            loop5:
            do {
                int alt5=2;
                int LA5_0 = input.LA(1);

                if ( ((LA5_0>=COMMENT && LA5_0<=TO)||(LA5_0>=MAKE && LA5_0<=OUTPUT)||LA5_0==43) ) {
                    alt5=1;
                }


                switch (alt5) {
            	case 1 :
            	    // /home/bartushk/Desktop/antlr/LogoTurtle.g:40:14: stat
            	    {
            	    pushFollow(FOLLOW_stat_in_block339);
            	    stat51=stat();

            	    state._fsp--;

            	    adaptor.addChild(root_0, stat51.getTree());

            	    }
            	    break;

            	default :
            	    if ( cnt5 >= 1 ) break loop5;
                        EarlyExitException eee =
                            new EarlyExitException(5, input);
                        throw eee;
                }
                cnt5++;
            } while (true);

            char_literal52=(Token)match(input,42,FOLLOW_42_in_block342); 

            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "block"

    public static class print_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "print"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:44:1: print : ( PRINT expr -> ^( PRINT ( expr )+ ) | '(' PRINT ( expr )+ ')' -> ^( PRINT ( expr )+ ) );
    public final LogoTurtleParser.print_return print() throws RecognitionException {
        LogoTurtleParser.print_return retval = new LogoTurtleParser.print_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token PRINT53=null;
        Token char_literal55=null;
        Token PRINT56=null;
        Token char_literal58=null;
        LogoTurtleParser.expr_return expr54 = null;

        LogoTurtleParser.expr_return expr57 = null;


        CommonTree PRINT53_tree=null;
        CommonTree char_literal55_tree=null;
        CommonTree PRINT56_tree=null;
        CommonTree char_literal58_tree=null;
        RewriteRuleTokenStream stream_43=new RewriteRuleTokenStream(adaptor,"token 43");
        RewriteRuleTokenStream stream_44=new RewriteRuleTokenStream(adaptor,"token 44");
        RewriteRuleTokenStream stream_PRINT=new RewriteRuleTokenStream(adaptor,"token PRINT");
        RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:44:7: ( PRINT expr -> ^( PRINT ( expr )+ ) | '(' PRINT ( expr )+ ')' -> ^( PRINT ( expr )+ ) )
            int alt7=2;
            int LA7_0 = input.LA(1);

            if ( (LA7_0==PRINT) ) {
                alt7=1;
            }
            else if ( (LA7_0==43) ) {
                alt7=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 7, 0, input);

                throw nvae;
            }
            switch (alt7) {
                case 1 :
                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:44:9: PRINT expr
                    {
                    PRINT53=(Token)match(input,PRINT,FOLLOW_PRINT_in_print358);  
                    stream_PRINT.add(PRINT53);

                    pushFollow(FOLLOW_expr_in_print360);
                    expr54=expr();

                    state._fsp--;

                    stream_expr.add(expr54.getTree());


                    // AST REWRITE
                    // elements: expr, PRINT
                    // token labels: 
                    // rule labels: retval
                    // token list labels: 
                    // rule list labels: 
                    // wildcard labels: 
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

                    root_0 = (CommonTree)adaptor.nil();
                    // 44:20: -> ^( PRINT ( expr )+ )
                    {
                        // /home/bartushk/Desktop/antlr/LogoTurtle.g:44:23: ^( PRINT ( expr )+ )
                        {
                        CommonTree root_1 = (CommonTree)adaptor.nil();
                        root_1 = (CommonTree)adaptor.becomeRoot(stream_PRINT.nextNode(), root_1);

                        if ( !(stream_expr.hasNext()) ) {
                            throw new RewriteEarlyExitException();
                        }
                        while ( stream_expr.hasNext() ) {
                            adaptor.addChild(root_1, stream_expr.nextTree());

                        }
                        stream_expr.reset();

                        adaptor.addChild(root_0, root_1);
                        }

                    }

                    retval.tree = root_0;
                    }
                    break;
                case 2 :
                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:45:4: '(' PRINT ( expr )+ ')'
                    {
                    char_literal55=(Token)match(input,43,FOLLOW_43_in_print374);  
                    stream_43.add(char_literal55);

                    PRINT56=(Token)match(input,PRINT,FOLLOW_PRINT_in_print376);  
                    stream_PRINT.add(PRINT56);

                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:45:14: ( expr )+
                    int cnt6=0;
                    loop6:
                    do {
                        int alt6=2;
                        int LA6_0 = input.LA(1);

                        if ( ((LA6_0>=ID && LA6_0<=INT)||LA6_0==REFOP||LA6_0==MOD||LA6_0==43) ) {
                            alt6=1;
                        }


                        switch (alt6) {
                    	case 1 :
                    	    // /home/bartushk/Desktop/antlr/LogoTurtle.g:45:14: expr
                    	    {
                    	    pushFollow(FOLLOW_expr_in_print378);
                    	    expr57=expr();

                    	    state._fsp--;

                    	    stream_expr.add(expr57.getTree());

                    	    }
                    	    break;

                    	default :
                    	    if ( cnt6 >= 1 ) break loop6;
                                EarlyExitException eee =
                                    new EarlyExitException(6, input);
                                throw eee;
                        }
                        cnt6++;
                    } while (true);

                    char_literal58=(Token)match(input,44,FOLLOW_44_in_print381);  
                    stream_44.add(char_literal58);



                    // AST REWRITE
                    // elements: PRINT, expr
                    // token labels: 
                    // rule labels: retval
                    // token list labels: 
                    // rule list labels: 
                    // wildcard labels: 
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

                    root_0 = (CommonTree)adaptor.nil();
                    // 45:24: -> ^( PRINT ( expr )+ )
                    {
                        // /home/bartushk/Desktop/antlr/LogoTurtle.g:45:27: ^( PRINT ( expr )+ )
                        {
                        CommonTree root_1 = (CommonTree)adaptor.nil();
                        root_1 = (CommonTree)adaptor.becomeRoot(stream_PRINT.nextNode(), root_1);

                        if ( !(stream_expr.hasNext()) ) {
                            throw new RewriteEarlyExitException();
                        }
                        while ( stream_expr.hasNext() ) {
                            adaptor.addChild(root_1, stream_expr.nextTree());

                        }
                        stream_expr.reset();

                        adaptor.addChild(root_0, root_1);
                        }

                    }

                    retval.tree = root_0;
                    }
                    break;

            }
            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "print"

    public static class funcmake_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "funcmake"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:48:1: funcmake : TO funcbody END -> ^( TO funcbody ) ;
    public final LogoTurtleParser.funcmake_return funcmake() throws RecognitionException {
        LogoTurtleParser.funcmake_return retval = new LogoTurtleParser.funcmake_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token TO59=null;
        Token END61=null;
        LogoTurtleParser.funcbody_return funcbody60 = null;


        CommonTree TO59_tree=null;
        CommonTree END61_tree=null;
        RewriteRuleTokenStream stream_TO=new RewriteRuleTokenStream(adaptor,"token TO");
        RewriteRuleTokenStream stream_END=new RewriteRuleTokenStream(adaptor,"token END");
        RewriteRuleSubtreeStream stream_funcbody=new RewriteRuleSubtreeStream(adaptor,"rule funcbody");
        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:48:10: ( TO funcbody END -> ^( TO funcbody ) )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:48:12: TO funcbody END
            {
            TO59=(Token)match(input,TO,FOLLOW_TO_in_funcmake401);  
            stream_TO.add(TO59);

            pushFollow(FOLLOW_funcbody_in_funcmake403);
            funcbody60=funcbody();

            state._fsp--;

            stream_funcbody.add(funcbody60.getTree());
            END61=(Token)match(input,END,FOLLOW_END_in_funcmake405);  
            stream_END.add(END61);



            // AST REWRITE
            // elements: TO, funcbody
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 48:28: -> ^( TO funcbody )
            {
                // /home/bartushk/Desktop/antlr/LogoTurtle.g:48:31: ^( TO funcbody )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_TO.nextNode(), root_1);

                adaptor.addChild(root_1, stream_funcbody.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "funcmake"

    public static class funcbody_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "funcbody"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:51:1: funcbody : ID '(' ( expr )+ ')' endstat ( stat )+ -> ^( ID ( expr )+ ( stat )+ ) ;
    public final LogoTurtleParser.funcbody_return funcbody() throws RecognitionException {
        LogoTurtleParser.funcbody_return retval = new LogoTurtleParser.funcbody_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token ID62=null;
        Token char_literal63=null;
        Token char_literal65=null;
        LogoTurtleParser.expr_return expr64 = null;

        LogoTurtleParser.endstat_return endstat66 = null;

        LogoTurtleParser.stat_return stat67 = null;


        CommonTree ID62_tree=null;
        CommonTree char_literal63_tree=null;
        CommonTree char_literal65_tree=null;
        RewriteRuleTokenStream stream_43=new RewriteRuleTokenStream(adaptor,"token 43");
        RewriteRuleTokenStream stream_44=new RewriteRuleTokenStream(adaptor,"token 44");
        RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID");
        RewriteRuleSubtreeStream stream_endstat=new RewriteRuleSubtreeStream(adaptor,"rule endstat");
        RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
        RewriteRuleSubtreeStream stream_stat=new RewriteRuleSubtreeStream(adaptor,"rule stat");
        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:51:10: ( ID '(' ( expr )+ ')' endstat ( stat )+ -> ^( ID ( expr )+ ( stat )+ ) )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:51:12: ID '(' ( expr )+ ')' endstat ( stat )+
            {
            ID62=(Token)match(input,ID,FOLLOW_ID_in_funcbody424);  
            stream_ID.add(ID62);

            char_literal63=(Token)match(input,43,FOLLOW_43_in_funcbody426);  
            stream_43.add(char_literal63);

            // /home/bartushk/Desktop/antlr/LogoTurtle.g:51:19: ( expr )+
            int cnt8=0;
            loop8:
            do {
                int alt8=2;
                int LA8_0 = input.LA(1);

                if ( ((LA8_0>=ID && LA8_0<=INT)||LA8_0==REFOP||LA8_0==MOD||LA8_0==43) ) {
                    alt8=1;
                }


                switch (alt8) {
            	case 1 :
            	    // /home/bartushk/Desktop/antlr/LogoTurtle.g:51:19: expr
            	    {
            	    pushFollow(FOLLOW_expr_in_funcbody428);
            	    expr64=expr();

            	    state._fsp--;

            	    stream_expr.add(expr64.getTree());

            	    }
            	    break;

            	default :
            	    if ( cnt8 >= 1 ) break loop8;
                        EarlyExitException eee =
                            new EarlyExitException(8, input);
                        throw eee;
                }
                cnt8++;
            } while (true);

            char_literal65=(Token)match(input,44,FOLLOW_44_in_funcbody431);  
            stream_44.add(char_literal65);

            pushFollow(FOLLOW_endstat_in_funcbody433);
            endstat66=endstat();

            state._fsp--;

            stream_endstat.add(endstat66.getTree());
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:51:37: ( stat )+
            int cnt9=0;
            loop9:
            do {
                int alt9=2;
                int LA9_0 = input.LA(1);

                if ( ((LA9_0>=COMMENT && LA9_0<=TO)||(LA9_0>=MAKE && LA9_0<=OUTPUT)||LA9_0==43) ) {
                    alt9=1;
                }


                switch (alt9) {
            	case 1 :
            	    // /home/bartushk/Desktop/antlr/LogoTurtle.g:51:37: stat
            	    {
            	    pushFollow(FOLLOW_stat_in_funcbody435);
            	    stat67=stat();

            	    state._fsp--;

            	    stream_stat.add(stat67.getTree());

            	    }
            	    break;

            	default :
            	    if ( cnt9 >= 1 ) break loop9;
                        EarlyExitException eee =
                            new EarlyExitException(9, input);
                        throw eee;
                }
                cnt9++;
            } while (true);



            // AST REWRITE
            // elements: expr, ID, stat
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 51:43: -> ^( ID ( expr )+ ( stat )+ )
            {
                // /home/bartushk/Desktop/antlr/LogoTurtle.g:51:46: ^( ID ( expr )+ ( stat )+ )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_ID.nextNode(), root_1);

                if ( !(stream_expr.hasNext()) ) {
                    throw new RewriteEarlyExitException();
                }
                while ( stream_expr.hasNext() ) {
                    adaptor.addChild(root_1, stream_expr.nextTree());

                }
                stream_expr.reset();
                if ( !(stream_stat.hasNext()) ) {
                    throw new RewriteEarlyExitException();
                }
                while ( stream_stat.hasNext() ) {
                    adaptor.addChild(root_1, stream_stat.nextTree());

                }
                stream_stat.reset();

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "funcbody"

    public static class funccall_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "funccall"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:54:1: funccall : ID '(' ( expr )+ ')' ;
    public final LogoTurtleParser.funccall_return funccall() throws RecognitionException {
        LogoTurtleParser.funccall_return retval = new LogoTurtleParser.funccall_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token ID68=null;
        Token char_literal69=null;
        Token char_literal71=null;
        LogoTurtleParser.expr_return expr70 = null;


        CommonTree ID68_tree=null;
        CommonTree char_literal69_tree=null;
        CommonTree char_literal71_tree=null;

        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:54:10: ( ID '(' ( expr )+ ')' )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:54:12: ID '(' ( expr )+ ')'
            {
            root_0 = (CommonTree)adaptor.nil();

            ID68=(Token)match(input,ID,FOLLOW_ID_in_funccall461); 
            ID68_tree = (CommonTree)adaptor.create(ID68);
            root_0 = (CommonTree)adaptor.becomeRoot(ID68_tree, root_0);

            char_literal69=(Token)match(input,43,FOLLOW_43_in_funccall464); 
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:54:21: ( expr )+
            int cnt10=0;
            loop10:
            do {
                int alt10=2;
                int LA10_0 = input.LA(1);

                if ( ((LA10_0>=ID && LA10_0<=INT)||LA10_0==REFOP||LA10_0==MOD||LA10_0==43) ) {
                    alt10=1;
                }


                switch (alt10) {
            	case 1 :
            	    // /home/bartushk/Desktop/antlr/LogoTurtle.g:54:21: expr
            	    {
            	    pushFollow(FOLLOW_expr_in_funccall467);
            	    expr70=expr();

            	    state._fsp--;

            	    adaptor.addChild(root_0, expr70.getTree());

            	    }
            	    break;

            	default :
            	    if ( cnt10 >= 1 ) break loop10;
                        EarlyExitException eee =
                            new EarlyExitException(10, input);
                        throw eee;
                }
                cnt10++;
            } while (true);

            char_literal71=(Token)match(input,44,FOLLOW_44_in_funccall470); 

            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "funccall"

    public static class number_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "number"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:57:1: number : ( FLOAT | INT );
    public final LogoTurtleParser.number_return number() throws RecognitionException {
        LogoTurtleParser.number_return retval = new LogoTurtleParser.number_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token set72=null;

        CommonTree set72_tree=null;

        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:57:8: ( FLOAT | INT )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:
            {
            root_0 = (CommonTree)adaptor.nil();

            set72=(Token)input.LT(1);
            if ( (input.LA(1)>=FLOAT && input.LA(1)<=INT) ) {
                input.consume();
                adaptor.addChild(root_0, (CommonTree)adaptor.create(set72));
                state.errorRecovery=false;
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                throw mse;
            }


            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "number"

    public static class make_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "make"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:60:1: make : MAKE var expr -> ^( MAKE var expr ) ;
    public final LogoTurtleParser.make_return make() throws RecognitionException {
        LogoTurtleParser.make_return retval = new LogoTurtleParser.make_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token MAKE73=null;
        LogoTurtleParser.var_return var74 = null;

        LogoTurtleParser.expr_return expr75 = null;


        CommonTree MAKE73_tree=null;
        RewriteRuleTokenStream stream_MAKE=new RewriteRuleTokenStream(adaptor,"token MAKE");
        RewriteRuleSubtreeStream stream_var=new RewriteRuleSubtreeStream(adaptor,"rule var");
        RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:60:6: ( MAKE var expr -> ^( MAKE var expr ) )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:60:8: MAKE var expr
            {
            MAKE73=(Token)match(input,MAKE,FOLLOW_MAKE_in_make496);  
            stream_MAKE.add(MAKE73);

            pushFollow(FOLLOW_var_in_make498);
            var74=var();

            state._fsp--;

            stream_var.add(var74.getTree());
            pushFollow(FOLLOW_expr_in_make500);
            expr75=expr();

            state._fsp--;

            stream_expr.add(expr75.getTree());


            // AST REWRITE
            // elements: MAKE, expr, var
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 60:22: -> ^( MAKE var expr )
            {
                // /home/bartushk/Desktop/antlr/LogoTurtle.g:60:25: ^( MAKE var expr )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_MAKE.nextNode(), root_1);

                adaptor.addChild(root_1, stream_var.nextTree());
                adaptor.addChild(root_1, stream_expr.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "make"

    public static class funcreturn_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "funcreturn"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:63:1: funcreturn : OUTPUT expr -> ^( OUTPUT expr ) ;
    public final LogoTurtleParser.funcreturn_return funcreturn() throws RecognitionException {
        LogoTurtleParser.funcreturn_return retval = new LogoTurtleParser.funcreturn_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token OUTPUT76=null;
        LogoTurtleParser.expr_return expr77 = null;


        CommonTree OUTPUT76_tree=null;
        RewriteRuleTokenStream stream_OUTPUT=new RewriteRuleTokenStream(adaptor,"token OUTPUT");
        RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:63:12: ( OUTPUT expr -> ^( OUTPUT expr ) )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:63:14: OUTPUT expr
            {
            OUTPUT76=(Token)match(input,OUTPUT,FOLLOW_OUTPUT_in_funcreturn521);  
            stream_OUTPUT.add(OUTPUT76);

            pushFollow(FOLLOW_expr_in_funcreturn523);
            expr77=expr();

            state._fsp--;

            stream_expr.add(expr77.getTree());


            // AST REWRITE
            // elements: expr, OUTPUT
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 63:26: -> ^( OUTPUT expr )
            {
                // /home/bartushk/Desktop/antlr/LogoTurtle.g:63:29: ^( OUTPUT expr )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_OUTPUT.nextNode(), root_1);

                adaptor.addChild(root_1, stream_expr.nextTree());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "funcreturn"

    public static class var_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "var"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:66:1: var : REFOP ID -> ^( REFOP ID ) ;
    public final LogoTurtleParser.var_return var() throws RecognitionException {
        LogoTurtleParser.var_return retval = new LogoTurtleParser.var_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token REFOP78=null;
        Token ID79=null;

        CommonTree REFOP78_tree=null;
        CommonTree ID79_tree=null;
        RewriteRuleTokenStream stream_REFOP=new RewriteRuleTokenStream(adaptor,"token REFOP");
        RewriteRuleTokenStream stream_ID=new RewriteRuleTokenStream(adaptor,"token ID");

        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:66:5: ( REFOP ID -> ^( REFOP ID ) )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:66:7: REFOP ID
            {
            REFOP78=(Token)match(input,REFOP,FOLLOW_REFOP_in_var544);  
            stream_REFOP.add(REFOP78);

            ID79=(Token)match(input,ID,FOLLOW_ID_in_var547);  
            stream_ID.add(ID79);



            // AST REWRITE
            // elements: REFOP, ID
            // token labels: 
            // rule labels: retval
            // token list labels: 
            // rule list labels: 
            // wildcard labels: 
            retval.tree = root_0;
            RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

            root_0 = (CommonTree)adaptor.nil();
            // 66:17: -> ^( REFOP ID )
            {
                // /home/bartushk/Desktop/antlr/LogoTurtle.g:66:20: ^( REFOP ID )
                {
                CommonTree root_1 = (CommonTree)adaptor.nil();
                root_1 = (CommonTree)adaptor.becomeRoot(stream_REFOP.nextNode(), root_1);

                adaptor.addChild(root_1, stream_ID.nextNode());

                adaptor.addChild(root_0, root_1);
                }

            }

            retval.tree = root_0;
            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "var"

    public static class compare_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "compare"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:69:1: compare : ( expr COMPOP expr -> ^( COMPOP ( expr )+ ) | NOT compare -> ^( NOT compare ) );
    public final LogoTurtleParser.compare_return compare() throws RecognitionException {
        LogoTurtleParser.compare_return retval = new LogoTurtleParser.compare_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token COMPOP81=null;
        Token NOT83=null;
        LogoTurtleParser.expr_return expr80 = null;

        LogoTurtleParser.expr_return expr82 = null;

        LogoTurtleParser.compare_return compare84 = null;


        CommonTree COMPOP81_tree=null;
        CommonTree NOT83_tree=null;
        RewriteRuleTokenStream stream_NOT=new RewriteRuleTokenStream(adaptor,"token NOT");
        RewriteRuleTokenStream stream_COMPOP=new RewriteRuleTokenStream(adaptor,"token COMPOP");
        RewriteRuleSubtreeStream stream_compare=new RewriteRuleSubtreeStream(adaptor,"rule compare");
        RewriteRuleSubtreeStream stream_expr=new RewriteRuleSubtreeStream(adaptor,"rule expr");
        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:69:9: ( expr COMPOP expr -> ^( COMPOP ( expr )+ ) | NOT compare -> ^( NOT compare ) )
            int alt11=2;
            int LA11_0 = input.LA(1);

            if ( ((LA11_0>=ID && LA11_0<=INT)||LA11_0==REFOP||LA11_0==MOD||LA11_0==43) ) {
                alt11=1;
            }
            else if ( (LA11_0==NOT) ) {
                alt11=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 11, 0, input);

                throw nvae;
            }
            switch (alt11) {
                case 1 :
                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:69:11: expr COMPOP expr
                    {
                    pushFollow(FOLLOW_expr_in_compare565);
                    expr80=expr();

                    state._fsp--;

                    stream_expr.add(expr80.getTree());
                    COMPOP81=(Token)match(input,COMPOP,FOLLOW_COMPOP_in_compare567);  
                    stream_COMPOP.add(COMPOP81);

                    pushFollow(FOLLOW_expr_in_compare569);
                    expr82=expr();

                    state._fsp--;

                    stream_expr.add(expr82.getTree());


                    // AST REWRITE
                    // elements: COMPOP, expr
                    // token labels: 
                    // rule labels: retval
                    // token list labels: 
                    // rule list labels: 
                    // wildcard labels: 
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

                    root_0 = (CommonTree)adaptor.nil();
                    // 69:28: -> ^( COMPOP ( expr )+ )
                    {
                        // /home/bartushk/Desktop/antlr/LogoTurtle.g:69:31: ^( COMPOP ( expr )+ )
                        {
                        CommonTree root_1 = (CommonTree)adaptor.nil();
                        root_1 = (CommonTree)adaptor.becomeRoot(stream_COMPOP.nextNode(), root_1);

                        if ( !(stream_expr.hasNext()) ) {
                            throw new RewriteEarlyExitException();
                        }
                        while ( stream_expr.hasNext() ) {
                            adaptor.addChild(root_1, stream_expr.nextTree());

                        }
                        stream_expr.reset();

                        adaptor.addChild(root_0, root_1);
                        }

                    }

                    retval.tree = root_0;
                    }
                    break;
                case 2 :
                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:70:4: NOT compare
                    {
                    NOT83=(Token)match(input,NOT,FOLLOW_NOT_in_compare583);  
                    stream_NOT.add(NOT83);

                    pushFollow(FOLLOW_compare_in_compare585);
                    compare84=compare();

                    state._fsp--;

                    stream_compare.add(compare84.getTree());


                    // AST REWRITE
                    // elements: NOT, compare
                    // token labels: 
                    // rule labels: retval
                    // token list labels: 
                    // rule list labels: 
                    // wildcard labels: 
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

                    root_0 = (CommonTree)adaptor.nil();
                    // 70:16: -> ^( NOT compare )
                    {
                        // /home/bartushk/Desktop/antlr/LogoTurtle.g:70:19: ^( NOT compare )
                        {
                        CommonTree root_1 = (CommonTree)adaptor.nil();
                        root_1 = (CommonTree)adaptor.becomeRoot(stream_NOT.nextNode(), root_1);

                        adaptor.addChild(root_1, stream_compare.nextTree());

                        adaptor.addChild(root_0, root_1);
                        }

                    }

                    retval.tree = root_0;
                    }
                    break;

            }
            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "compare"

    public static class endstat_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "endstat"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:73:1: endstat : ( COMMENT )* ( NEWLINE )* ( WS )* ;
    public final LogoTurtleParser.endstat_return endstat() throws RecognitionException {
        LogoTurtleParser.endstat_return retval = new LogoTurtleParser.endstat_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token COMMENT85=null;
        Token NEWLINE86=null;
        Token WS87=null;

        CommonTree COMMENT85_tree=null;
        CommonTree NEWLINE86_tree=null;
        CommonTree WS87_tree=null;

        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:73:9: ( ( COMMENT )* ( NEWLINE )* ( WS )* )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:73:11: ( COMMENT )* ( NEWLINE )* ( WS )*
            {
            root_0 = (CommonTree)adaptor.nil();

            // /home/bartushk/Desktop/antlr/LogoTurtle.g:73:11: ( COMMENT )*
            loop12:
            do {
                int alt12=2;
                int LA12_0 = input.LA(1);

                if ( (LA12_0==COMMENT) ) {
                    alt12=1;
                }


                switch (alt12) {
            	case 1 :
            	    // /home/bartushk/Desktop/antlr/LogoTurtle.g:73:11: COMMENT
            	    {
            	    COMMENT85=(Token)match(input,COMMENT,FOLLOW_COMMENT_in_endstat604); 
            	    COMMENT85_tree = (CommonTree)adaptor.create(COMMENT85);
            	    adaptor.addChild(root_0, COMMENT85_tree);


            	    }
            	    break;

            	default :
            	    break loop12;
                }
            } while (true);

            // /home/bartushk/Desktop/antlr/LogoTurtle.g:73:19: ( NEWLINE )*
            loop13:
            do {
                int alt13=2;
                int LA13_0 = input.LA(1);

                if ( (LA13_0==NEWLINE) ) {
                    alt13=1;
                }


                switch (alt13) {
            	case 1 :
            	    // /home/bartushk/Desktop/antlr/LogoTurtle.g:73:19: NEWLINE
            	    {
            	    NEWLINE86=(Token)match(input,NEWLINE,FOLLOW_NEWLINE_in_endstat606); 
            	    NEWLINE86_tree = (CommonTree)adaptor.create(NEWLINE86);
            	    adaptor.addChild(root_0, NEWLINE86_tree);


            	    }
            	    break;

            	default :
            	    break loop13;
                }
            } while (true);

            // /home/bartushk/Desktop/antlr/LogoTurtle.g:73:27: ( WS )*
            loop14:
            do {
                int alt14=2;
                int LA14_0 = input.LA(1);

                if ( (LA14_0==WS) ) {
                    alt14=1;
                }


                switch (alt14) {
            	case 1 :
            	    // /home/bartushk/Desktop/antlr/LogoTurtle.g:73:27: WS
            	    {
            	    WS87=(Token)match(input,WS,FOLLOW_WS_in_endstat608); 
            	    WS87_tree = (CommonTree)adaptor.create(WS87);
            	    adaptor.addChild(root_0, WS87_tree);


            	    }
            	    break;

            	default :
            	    break loop14;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "endstat"

    public static class expr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "expr"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:76:1: expr : multExpr ( ( ADD | SUB ) multExpr )* ;
    public final LogoTurtleParser.expr_return expr() throws RecognitionException {
        LogoTurtleParser.expr_return retval = new LogoTurtleParser.expr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token ADD89=null;
        Token SUB90=null;
        LogoTurtleParser.multExpr_return multExpr88 = null;

        LogoTurtleParser.multExpr_return multExpr91 = null;


        CommonTree ADD89_tree=null;
        CommonTree SUB90_tree=null;

        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:76:6: ( multExpr ( ( ADD | SUB ) multExpr )* )
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:76:8: multExpr ( ( ADD | SUB ) multExpr )*
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_multExpr_in_expr619);
            multExpr88=multExpr();

            state._fsp--;

            adaptor.addChild(root_0, multExpr88.getTree());
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:76:17: ( ( ADD | SUB ) multExpr )*
            loop16:
            do {
                int alt16=2;
                int LA16_0 = input.LA(1);

                if ( ((LA16_0>=ADD && LA16_0<=SUB)) ) {
                    alt16=1;
                }


                switch (alt16) {
            	case 1 :
            	    // /home/bartushk/Desktop/antlr/LogoTurtle.g:76:18: ( ADD | SUB ) multExpr
            	    {
            	    // /home/bartushk/Desktop/antlr/LogoTurtle.g:76:18: ( ADD | SUB )
            	    int alt15=2;
            	    int LA15_0 = input.LA(1);

            	    if ( (LA15_0==ADD) ) {
            	        alt15=1;
            	    }
            	    else if ( (LA15_0==SUB) ) {
            	        alt15=2;
            	    }
            	    else {
            	        NoViableAltException nvae =
            	            new NoViableAltException("", 15, 0, input);

            	        throw nvae;
            	    }
            	    switch (alt15) {
            	        case 1 :
            	            // /home/bartushk/Desktop/antlr/LogoTurtle.g:76:19: ADD
            	            {
            	            ADD89=(Token)match(input,ADD,FOLLOW_ADD_in_expr623); 
            	            ADD89_tree = (CommonTree)adaptor.create(ADD89);
            	            root_0 = (CommonTree)adaptor.becomeRoot(ADD89_tree, root_0);


            	            }
            	            break;
            	        case 2 :
            	            // /home/bartushk/Desktop/antlr/LogoTurtle.g:76:24: SUB
            	            {
            	            SUB90=(Token)match(input,SUB,FOLLOW_SUB_in_expr626); 
            	            SUB90_tree = (CommonTree)adaptor.create(SUB90);
            	            root_0 = (CommonTree)adaptor.becomeRoot(SUB90_tree, root_0);


            	            }
            	            break;

            	    }

            	    pushFollow(FOLLOW_multExpr_in_expr630);
            	    multExpr91=multExpr();

            	    state._fsp--;

            	    adaptor.addChild(root_0, multExpr91.getTree());

            	    }
            	    break;

            	default :
            	    break loop16;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "expr"

    public static class multExpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "multExpr"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:79:1: multExpr : ( atom ( ( DIV | MUL ) atom )* | MOD atom atom -> ^( MOD atom atom ) );
    public final LogoTurtleParser.multExpr_return multExpr() throws RecognitionException {
        LogoTurtleParser.multExpr_return retval = new LogoTurtleParser.multExpr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token DIV93=null;
        Token MUL94=null;
        Token MOD96=null;
        LogoTurtleParser.atom_return atom92 = null;

        LogoTurtleParser.atom_return atom95 = null;

        LogoTurtleParser.atom_return atom97 = null;

        LogoTurtleParser.atom_return atom98 = null;


        CommonTree DIV93_tree=null;
        CommonTree MUL94_tree=null;
        CommonTree MOD96_tree=null;
        RewriteRuleTokenStream stream_MOD=new RewriteRuleTokenStream(adaptor,"token MOD");
        RewriteRuleSubtreeStream stream_atom=new RewriteRuleSubtreeStream(adaptor,"rule atom");
        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:79:10: ( atom ( ( DIV | MUL ) atom )* | MOD atom atom -> ^( MOD atom atom ) )
            int alt19=2;
            int LA19_0 = input.LA(1);

            if ( ((LA19_0>=ID && LA19_0<=INT)||LA19_0==REFOP||LA19_0==43) ) {
                alt19=1;
            }
            else if ( (LA19_0==MOD) ) {
                alt19=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 19, 0, input);

                throw nvae;
            }
            switch (alt19) {
                case 1 :
                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:79:12: atom ( ( DIV | MUL ) atom )*
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_atom_in_multExpr643);
                    atom92=atom();

                    state._fsp--;

                    adaptor.addChild(root_0, atom92.getTree());
                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:79:16: ( ( DIV | MUL ) atom )*
                    loop18:
                    do {
                        int alt18=2;
                        int LA18_0 = input.LA(1);

                        if ( ((LA18_0>=DIV && LA18_0<=MUL)) ) {
                            alt18=1;
                        }


                        switch (alt18) {
                    	case 1 :
                    	    // /home/bartushk/Desktop/antlr/LogoTurtle.g:79:17: ( DIV | MUL ) atom
                    	    {
                    	    // /home/bartushk/Desktop/antlr/LogoTurtle.g:79:17: ( DIV | MUL )
                    	    int alt17=2;
                    	    int LA17_0 = input.LA(1);

                    	    if ( (LA17_0==DIV) ) {
                    	        alt17=1;
                    	    }
                    	    else if ( (LA17_0==MUL) ) {
                    	        alt17=2;
                    	    }
                    	    else {
                    	        NoViableAltException nvae =
                    	            new NoViableAltException("", 17, 0, input);

                    	        throw nvae;
                    	    }
                    	    switch (alt17) {
                    	        case 1 :
                    	            // /home/bartushk/Desktop/antlr/LogoTurtle.g:79:18: DIV
                    	            {
                    	            DIV93=(Token)match(input,DIV,FOLLOW_DIV_in_multExpr646); 
                    	            DIV93_tree = (CommonTree)adaptor.create(DIV93);
                    	            root_0 = (CommonTree)adaptor.becomeRoot(DIV93_tree, root_0);


                    	            }
                    	            break;
                    	        case 2 :
                    	            // /home/bartushk/Desktop/antlr/LogoTurtle.g:79:23: MUL
                    	            {
                    	            MUL94=(Token)match(input,MUL,FOLLOW_MUL_in_multExpr649); 
                    	            MUL94_tree = (CommonTree)adaptor.create(MUL94);
                    	            root_0 = (CommonTree)adaptor.becomeRoot(MUL94_tree, root_0);


                    	            }
                    	            break;

                    	    }

                    	    pushFollow(FOLLOW_atom_in_multExpr653);
                    	    atom95=atom();

                    	    state._fsp--;

                    	    adaptor.addChild(root_0, atom95.getTree());

                    	    }
                    	    break;

                    	default :
                    	    break loop18;
                        }
                    } while (true);


                    }
                    break;
                case 2 :
                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:80:4: MOD atom atom
                    {
                    MOD96=(Token)match(input,MOD,FOLLOW_MOD_in_multExpr660);  
                    stream_MOD.add(MOD96);

                    pushFollow(FOLLOW_atom_in_multExpr662);
                    atom97=atom();

                    state._fsp--;

                    stream_atom.add(atom97.getTree());
                    pushFollow(FOLLOW_atom_in_multExpr664);
                    atom98=atom();

                    state._fsp--;

                    stream_atom.add(atom98.getTree());


                    // AST REWRITE
                    // elements: atom, MOD, atom
                    // token labels: 
                    // rule labels: retval
                    // token list labels: 
                    // rule list labels: 
                    // wildcard labels: 
                    retval.tree = root_0;
                    RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);

                    root_0 = (CommonTree)adaptor.nil();
                    // 80:18: -> ^( MOD atom atom )
                    {
                        // /home/bartushk/Desktop/antlr/LogoTurtle.g:80:21: ^( MOD atom atom )
                        {
                        CommonTree root_1 = (CommonTree)adaptor.nil();
                        root_1 = (CommonTree)adaptor.becomeRoot(stream_MOD.nextNode(), root_1);

                        adaptor.addChild(root_1, stream_atom.nextTree());
                        adaptor.addChild(root_1, stream_atom.nextTree());

                        adaptor.addChild(root_0, root_1);
                        }

                    }

                    retval.tree = root_0;
                    }
                    break;

            }
            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "multExpr"

    public static class atom_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "atom"
    // /home/bartushk/Desktop/antlr/LogoTurtle.g:83:1: atom : ( var | number | funccall | '(' expr ')' );
    public final LogoTurtleParser.atom_return atom() throws RecognitionException {
        LogoTurtleParser.atom_return retval = new LogoTurtleParser.atom_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal102=null;
        Token char_literal104=null;
        LogoTurtleParser.var_return var99 = null;

        LogoTurtleParser.number_return number100 = null;

        LogoTurtleParser.funccall_return funccall101 = null;

        LogoTurtleParser.expr_return expr103 = null;


        CommonTree char_literal102_tree=null;
        CommonTree char_literal104_tree=null;

        try {
            // /home/bartushk/Desktop/antlr/LogoTurtle.g:83:6: ( var | number | funccall | '(' expr ')' )
            int alt20=4;
            switch ( input.LA(1) ) {
            case REFOP:
                {
                alt20=1;
                }
                break;
            case FLOAT:
            case INT:
                {
                alt20=2;
                }
                break;
            case ID:
                {
                alt20=3;
                }
                break;
            case 43:
                {
                alt20=4;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 20, 0, input);

                throw nvae;
            }

            switch (alt20) {
                case 1 :
                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:83:8: var
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_var_in_atom685);
                    var99=var();

                    state._fsp--;

                    adaptor.addChild(root_0, var99.getTree());

                    }
                    break;
                case 2 :
                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:84:4: number
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_number_in_atom690);
                    number100=number();

                    state._fsp--;

                    adaptor.addChild(root_0, number100.getTree());

                    }
                    break;
                case 3 :
                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:85:4: funccall
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_funccall_in_atom695);
                    funccall101=funccall();

                    state._fsp--;

                    adaptor.addChild(root_0, funccall101.getTree());

                    }
                    break;
                case 4 :
                    // /home/bartushk/Desktop/antlr/LogoTurtle.g:86:4: '(' expr ')'
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    char_literal102=(Token)match(input,43,FOLLOW_43_in_atom700); 
                    pushFollow(FOLLOW_expr_in_atom703);
                    expr103=expr();

                    state._fsp--;

                    adaptor.addChild(root_0, expr103.getTree());
                    char_literal104=(Token)match(input,44,FOLLOW_44_in_atom705); 

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "atom"

    // Delegated rules


 

    public static final BitSet FOLLOW_stat_in_prog43 = new BitSet(new long[]{0x0000080061FFFFE2L});
    public static final BitSet FOLLOW_print_in_stat63 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_make_in_stat67 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_ifstat_in_stat71 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_whilestat_in_stat75 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_ifelse_in_stat79 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_funcmake_in_stat83 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_funcreturn_in_stat86 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_COMMENT_in_stat90 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_NEWLINE_in_stat95 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_WS_in_stat100 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_endstat_in_stat105 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_PENUP_in_stat112 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_PENDOWN_in_stat116 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_turtone_in_stat120 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_turtpos_in_stat124 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_turtcirc_in_stat128 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_turtpenc_in_stat132 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_BFILL_in_stat136 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_EFILL_in_stat140 = new BitSet(new long[]{0x00000000000000E0L});
    public static final BitSet FOLLOW_endstat_in_stat144 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_SETPOS_in_turtpos156 = new BitSet(new long[]{0x0000020000000000L});
    public static final BitSet FOLLOW_41_in_turtpos159 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_turtpos162 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_turtpos164 = new BitSet(new long[]{0x0000040000000000L});
    public static final BitSet FOLLOW_42_in_turtpos166 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_CIRCLE_in_turtcirc178 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_turtcirc181 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_turtcirc183 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_SETPEN_in_turtpenc194 = new BitSet(new long[]{0x0000020000000000L});
    public static final BitSet FOLLOW_41_in_turtpenc197 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_turtpenc200 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_turtpenc202 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_turtpenc204 = new BitSet(new long[]{0x0000040000000000L});
    public static final BitSet FOLLOW_42_in_turtpenc206 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_set_in_turtone219 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_turtone240 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_IFSTAT_in_ifstat251 = new BitSet(new long[]{0x000008429C000000L});
    public static final BitSet FOLLOW_compare_in_ifstat253 = new BitSet(new long[]{0x0000020000000000L});
    public static final BitSet FOLLOW_block_in_ifstat255 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_WHILESTAT_in_whilestat276 = new BitSet(new long[]{0x0000020000000000L});
    public static final BitSet FOLLOW_41_in_whilestat278 = new BitSet(new long[]{0x000008429C000000L});
    public static final BitSet FOLLOW_compare_in_whilestat280 = new BitSet(new long[]{0x0000040000000000L});
    public static final BitSet FOLLOW_42_in_whilestat282 = new BitSet(new long[]{0x0000020000000000L});
    public static final BitSet FOLLOW_block_in_whilestat284 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_IFELSE_in_ifelse305 = new BitSet(new long[]{0x000008429C000000L});
    public static final BitSet FOLLOW_compare_in_ifelse307 = new BitSet(new long[]{0x0000020000000000L});
    public static final BitSet FOLLOW_block_in_ifelse309 = new BitSet(new long[]{0x0000020000000000L});
    public static final BitSet FOLLOW_block_in_ifelse311 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_41_in_block336 = new BitSet(new long[]{0x00000C0061FFFFE0L});
    public static final BitSet FOLLOW_stat_in_block339 = new BitSet(new long[]{0x00000C0061FFFFE0L});
    public static final BitSet FOLLOW_42_in_block342 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_PRINT_in_print358 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_print360 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_43_in_print374 = new BitSet(new long[]{0x0000000000800000L});
    public static final BitSet FOLLOW_PRINT_in_print376 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_print378 = new BitSet(new long[]{0x000018409C000000L});
    public static final BitSet FOLLOW_44_in_print381 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_TO_in_funcmake401 = new BitSet(new long[]{0x0000000004000000L});
    public static final BitSet FOLLOW_funcbody_in_funcmake403 = new BitSet(new long[]{0x0000000002000000L});
    public static final BitSet FOLLOW_END_in_funcmake405 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ID_in_funcbody424 = new BitSet(new long[]{0x0000080000000000L});
    public static final BitSet FOLLOW_43_in_funcbody426 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_funcbody428 = new BitSet(new long[]{0x000018409C000000L});
    public static final BitSet FOLLOW_44_in_funcbody431 = new BitSet(new long[]{0x0000080061FFFFE0L});
    public static final BitSet FOLLOW_endstat_in_funcbody433 = new BitSet(new long[]{0x0000080061FFFFE0L});
    public static final BitSet FOLLOW_stat_in_funcbody435 = new BitSet(new long[]{0x0000080061FFFFE2L});
    public static final BitSet FOLLOW_ID_in_funccall461 = new BitSet(new long[]{0x0000080000000000L});
    public static final BitSet FOLLOW_43_in_funccall464 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_funccall467 = new BitSet(new long[]{0x000018409C000000L});
    public static final BitSet FOLLOW_44_in_funccall470 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_set_in_number0 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_MAKE_in_make496 = new BitSet(new long[]{0x0000000080000000L});
    public static final BitSet FOLLOW_var_in_make498 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_make500 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_OUTPUT_in_funcreturn521 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_funcreturn523 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_REFOP_in_var544 = new BitSet(new long[]{0x0000000004000000L});
    public static final BitSet FOLLOW_ID_in_var547 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_expr_in_compare565 = new BitSet(new long[]{0x0000000100000000L});
    public static final BitSet FOLLOW_COMPOP_in_compare567 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_compare569 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_NOT_in_compare583 = new BitSet(new long[]{0x000008429C000000L});
    public static final BitSet FOLLOW_compare_in_compare585 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_COMMENT_in_endstat604 = new BitSet(new long[]{0x00000000000000E2L});
    public static final BitSet FOLLOW_NEWLINE_in_endstat606 = new BitSet(new long[]{0x00000000000000C2L});
    public static final BitSet FOLLOW_WS_in_endstat608 = new BitSet(new long[]{0x0000000000000082L});
    public static final BitSet FOLLOW_multExpr_in_expr619 = new BitSet(new long[]{0x0000000C00000002L});
    public static final BitSet FOLLOW_ADD_in_expr623 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_SUB_in_expr626 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_multExpr_in_expr630 = new BitSet(new long[]{0x0000000C00000002L});
    public static final BitSet FOLLOW_atom_in_multExpr643 = new BitSet(new long[]{0x0000003000000002L});
    public static final BitSet FOLLOW_DIV_in_multExpr646 = new BitSet(new long[]{0x000008009C000000L});
    public static final BitSet FOLLOW_MUL_in_multExpr649 = new BitSet(new long[]{0x000008009C000000L});
    public static final BitSet FOLLOW_atom_in_multExpr653 = new BitSet(new long[]{0x0000003000000002L});
    public static final BitSet FOLLOW_MOD_in_multExpr660 = new BitSet(new long[]{0x000008009C000000L});
    public static final BitSet FOLLOW_atom_in_multExpr662 = new BitSet(new long[]{0x000008009C000000L});
    public static final BitSet FOLLOW_atom_in_multExpr664 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_var_in_atom685 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_number_in_atom690 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_funccall_in_atom695 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_43_in_atom700 = new BitSet(new long[]{0x000008409C000000L});
    public static final BitSet FOLLOW_expr_in_atom703 = new BitSet(new long[]{0x0000100000000000L});
    public static final BitSet FOLLOW_44_in_atom705 = new BitSet(new long[]{0x0000000000000002L});

}